<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>新闻评论</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/message.css">
<script language="javascript" type="text/javascript" src=""></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript">


</script>
<style type="text/css">
 body,td,div
 {
   font-size:12px;
 }
</style>
</head>
<body>
<jsp:include page="top.jsp"></jsp:include>
<div id="middle">
	 <div class="nav">当前位置: 主页 > 新闻评论> <span style="color:black;font-weight:bold"><s:property value="#attr.comment.comment_title" /></span> </div>
	<!-- 信息开始 -->
	 <div class="tzTop">
		 <div class="tzPhoto"><img src="<s:property value='#attr.comment.comment_pic' /> " style="width: 100px"/></div>
		 <div class="tzAdminTime">
				<div class="tzAdmin"><s:property value="#attr.comment.nick_name" /></div>
				<div class="tzTime">学号：<s:property value="#attr.comment.user_no" /></div>
				<div class="tzTime">发布时间：<s:property value="#attr.comment.comment_date.substring(0,19)" />　<img src="images/click2.gif" style="vertical-align:middle"/> 点击(<s:property value="#attr.comment.comment_click" />)　<img src="images/quote2.gif" style="vertical-align:middle"/>
				&nbsp;&nbsp;<a href="#link" onclick="initForm('<s:property value="#attr.comment.nick_name"/>','<s:property value="#attr.comment.comment_id"/>','<s:property value="#attr.comment.user_id"/>','-1','1');">[回复]</a></div>
		 </div>
	 </div>
	 <div class="tzCon">
			<s:property value="#attr.comment.comment_content" />
	 </div>
	 <div class="tzPic">
	 	<s:if test="#attr.commentPics!=null &&  #attr.commentPics.size() > 0">
	    <s:iterator value="#attr.commentPics" id="commentPic">
			<img src="/images/tzsc/<s:property value='#commentPic' />"/>&nbsp;
		</s:iterator>
	 	</s:if>
	 </div>
	<!-- 信息结束 -->

	<!-- 留言开始 -->
	 <div class="tzReplys">
	 	 <s:if test="#attr.commentReplies!=null &&  #attr.commentReplies.size() > 0">
	     <s:iterator value="#attr.commentReplies" id="commentReply">
	     <s:if test="#commentReply.comment_level > 1">
	     <div class="tzReply2">
			<div class="photo"><img src="<s:property value='#commentReply.comment_pic' />"/></div>
			<div class="replyConTime">
				<div class="replyCon"><s:property value="#commentReply.nick_name" /> [回复 <s:property value="#commentReply.reply_nick_name" />]：<s:property value="#commentReply.reply_content" /></div>
				<div class="replyTime">学号：<s:property value="#commentReply.user_no" />　回复时间：<s:property value="#commentReply.reply_date.substring(0,19)" />　<img src="images/quote2.gif" style="vertical-align:middle"/>
				&nbsp;&nbsp;<a href="#link" onclick="initForm('<s:property value="#commentReply.nick_name"/>','<s:property value="#attr.comment.comment_id"/>','<s:property value="#commentReply.user_id"/>','<s:property value="#commentReply.comment_reply_id"/>','2');">[回复]</a></div>
			</div>
		 </div>
	     </s:if>
	     <s:else>
	     <div class="tzReply">
			<div class="photo"><img src="<s:property value='#commentReply.comment_pic' />"/></div>
			<div class="replyConTime">
				<div class="replyCon"><s:property value="#commentReply.nick_name" />：<s:property value="#commentReply.reply_content" /></div>
				<div class="replyTime">学号：<s:property value="#commentReply.user_no" />　回复时间：<s:property value="#commentReply.reply_date.substring(0,19)" />　<img src="images/quote2.gif" style="vertical-align:middle"/>
				&nbsp;&nbsp;<a href="#link" onclick="initForm('<s:property value="#commentReply.nick_name"/>','<s:property value="#attr.comment.comment_id"/>','<s:property value="#commentReply.user_id"/>','<s:property value="#commentReply.comment_reply_id"/>','2');">[回复]</a></div>
			</div>
		 </div>
	     </s:else>

		</s:iterator>
	 	</s:if>
	 </div>
	 <!-- 留言结束 -->

	 <!-- 发表回复 -->
	 <form name="info" id="info" action="page_addCommentReply.action" method="post" style="width:100%;padding:2px;margin:0">
	 <input type="hidden" name="paramsCommentReply.user_id" id="paramsCommentReply.user_id" value="<s:property value='#attr.user.user_id' />"/>
	 <input type="hidden" name="paramsCommentReply.comment_id" id="paramsCommentReply.comment_id" value="<s:property value='#attr.comment.comment_id'/>"/>
	 <input type="hidden" name="paramsCommentReply.reply_user_id" id="paramsCommentReply.reply_user_id" value='<s:property value="#attr.comment.user_id"/>'/>
	 <input type="hidden" name="paramsCommentReply.comment_reply_pid" id="paramsCommentReply.comment_reply_pid" value="-1"/>
	 <input type="hidden" name="paramsCommentReply.comment_level" id="paramsCommentReply.comment_level" value="1"/>
	 <table class="reply_add">
			<tr>
				<td class="theme" colspan="4">发表回复：</td>
			</tr>
			<tr>
				<td align="right" width="18%">回复：</td>
				<td align="left" colspan="3" id="reply_title"><s:property value="#attr.comment.nick_name"/></td>
			</tr>
			<tr>
				<td align="right" width="18%">回复内容：</td>
				<td align="left" width="32%"><textarea name="paramsCommentReply.reply_content" id="paramsCommentReply.reply_content" style="width:200px;height:50px"  class="inputstyle"></textarea></td>
				<td align="right" width="18%">选择头像：</td>
				<td align="left">
					<input type="radio" name="paramsCommentReply.comment_pic" checked="checked" value="images/head/man04.gif" />
					<img src="images/head/man04.gif" width="50" />
					<input type="radio" name="paramsCommentReply.comment_pic" value="images/head/woman08.gif" />
					<img src="images/head/woman08.gif" width="50" />
				</td>
			</tr>
			<tr>
				<td align="center" colspan="4">
					<input type="button" id="replyBtn" class="btnstyle" value="提交"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="reset" class="btnstyle" value="清空"/>
				</td>
			</tr>
	 </table>
	 <a name="link"></a>
	 </form>
</div>
<jsp:include page="bottom.jsp"></jsp:include>
<script type="text/javascript">
var tip = "${tip}";
if(tip!=''){
	alert(tip);
}
var user_id = "<s:property value='#attr.user.user_id' />";
//实现验证码点击刷新
function reloadcode(){
	var verify=document.getElementById('safecode');
	verify.setAttribute('src','Random.jsp?'+Math.random());
}
function initForm(nick_name,comment_id,reply_user_id,comment_reply_pid,comment_level){
	document.getElementById('paramsCommentReply.reply_content').focus();
	document.info.focus();
	document.getElementById('paramsCommentReply.comment_id').value=comment_id;
	document.getElementById('paramsCommentReply.reply_user_id').value=reply_user_id;
	document.getElementById('paramsCommentReply.comment_reply_pid').value=comment_reply_pid;
	document.getElementById('paramsCommentReply.comment_level').value=comment_level;
	document.getElementById('reply_title').innerHTML=nick_name;
}
$(document).ready(function(){
	var reply_content = $("#paramsSblogReply.reply_content");
	$("#replyBtn").bind("click",function(){
		if(user_id==''){
			alert('请先登录后再进行回复！')
			return;
		}
		if(reply_content.val()==''){
			alert('回复内容不能为空！')
			return;
		}
		$("#info").submit();
	});

});


</script>
</body>
</html>